import React, { useRef,useState,useEffect, useMemo } from 'react';

function Example9(){
    const intterUL=useRef()
    const Tap=()=>{
        intterUL.current.value="Hellow Tim"
        console.log(intterUL.current.value)
    }
    const[text,setText]=useState('Tim')
    const changeText=useRef()
    useEffect(()=>{
        changeText.current=text;
        console.log(changeText.current)
    },[])
    return(
        <>
            <input ref={intterUL} type="text" />
            <button onClick={Tap}>change</button>
            <br/>
            <br/>
            <br/>
            <input value={text} onChange={(e)=>{setText(e.target.value)}}/>
        </>
    )
}

export default Example9